﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ModernUIApp1.Pages
{
    /// <summary>
    /// Interaction logic for Home.xaml
    /// </summary>
    public partial class Home : UserControl
    {

        private ObservableCollection<Run> runs;

        public Home()
        {
            InitializeComponent();
            LoadRuns();
        }

        public void LoadRuns()
        {
            runs = new ObservableCollection<Run>();
            WcfConnection wcfConnection = new WcfConnection();
            Object id = ApplicationState.GetValue("id");

            List<Run> dbRuns = wcfConnection.getRuns((int) id);

            foreach (Run run in dbRuns)
            {
                runs.Add(run);
            }
            
            runsNews.ItemsSource = runs;
        }
    }
}
